package com.ruoyi.tcm.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.tcm.mapper.TcmKnowledgeBaseMapper;
import com.ruoyi.tcm.domain.TcmKnowledgeBase;
import com.ruoyi.tcm.service.ITcmKnowledgeBaseService;

/**
 * 知识库Service业务层处理
 * 
 * @author cong
 * @date 2025-02-07
 */
@Service
public class TcmKnowledgeBaseServiceImpl implements ITcmKnowledgeBaseService 
{
    @Autowired
    private TcmKnowledgeBaseMapper tcmKnowledgeBaseMapper;

    /**
     * 查询知识库
     * 
     * @param id 知识库主键
     * @return 知识库
     */
    @Override
    public TcmKnowledgeBase selectTcmKnowledgeBaseById(Long id)
    {
        return tcmKnowledgeBaseMapper.selectTcmKnowledgeBaseById(id);
    }

    /**
     * 查询知识库列表
     * 
     * @param tcmKnowledgeBase 知识库
     * @return 知识库
     */
    @Override
    public List<TcmKnowledgeBase> selectTcmKnowledgeBaseList(TcmKnowledgeBase tcmKnowledgeBase)
    {
        return tcmKnowledgeBaseMapper.selectTcmKnowledgeBaseList(tcmKnowledgeBase);
    }

    /**
     * 新增知识库
     * 
     * @param tcmKnowledgeBase 知识库
     * @return 结果
     */
    @Override
    public int insertTcmKnowledgeBase(TcmKnowledgeBase tcmKnowledgeBase)
    {
        tcmKnowledgeBase.setCreateTime(DateUtils.getNowDate());
        return tcmKnowledgeBaseMapper.insertTcmKnowledgeBase(tcmKnowledgeBase);
    }

    /**
     * 修改知识库
     * 
     * @param tcmKnowledgeBase 知识库
     * @return 结果
     */
    @Override
    public int updateTcmKnowledgeBase(TcmKnowledgeBase tcmKnowledgeBase)
    {
        tcmKnowledgeBase.setUpdateTime(DateUtils.getNowDate());
        return tcmKnowledgeBaseMapper.updateTcmKnowledgeBase(tcmKnowledgeBase);
    }

    /**
     * 批量删除知识库
     * 
     * @param ids 需要删除的知识库主键
     * @return 结果
     */
    @Override
    public int deleteTcmKnowledgeBaseByIds(Long[] ids)
    {
        return tcmKnowledgeBaseMapper.deleteTcmKnowledgeBaseByIds(ids);
    }

    /**
     * 删除知识库信息
     * 
     * @param id 知识库主键
     * @return 结果
     */
    @Override
    public int deleteTcmKnowledgeBaseById(Long id)
    {
        return tcmKnowledgeBaseMapper.deleteTcmKnowledgeBaseById(id);
    }
}
